package com.zg.autoflow.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zg.autoflow.req.SettleWorkflowBackApprovalPageReq;
import com.zg.autoflow.req.SettleWorkflowBackApprovalUpdateReq;
import com.zg.autoflow.service.SettleWorkflowBackApprovalService;
import com.zg.autoflow.vo.SettleWorkflowBackApprovalVo;
import com.zg.common.core.R;
import com.zg.common.core.dao.autoflow.entity.SettleWorkflowBackApproval;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequiredArgsConstructor
@Api(tags = {"退回审批"})
public class SettleWorkflowBackApprovalController {

    private final SettleWorkflowBackApprovalService settleWorkflowBackApprovalService;

    /**
     * 审核退回审批
     * @return
     */
    @ApiOperation("审批列表")
    @PostMapping(name = "退回审批", path = "/settle/Workflow/back/backApproval")
    public R backApproval(@RequestBody @Valid SettleWorkflowBackApprovalUpdateReq req) {
        return settleWorkflowBackApprovalService.backApproval(req);
    }

    /**
     * 查询审批列表
     * @return
     */
    @ApiOperation("查询审批列表")
    @PostMapping(name = "审批人查询退回审批记录", path = "/settle/Workflow/back/getBackApproval")
    public R<IPage<SettleWorkflowBackApprovalVo>> getBackApproval(@RequestBody SettleWorkflowBackApprovalPageReq req) {
        return settleWorkflowBackApprovalService.getBackApproval(req);
    }

}
